#-*-coding:utf-8-*- #告知用utf-8格式
#获取
import requests
r = requests.get('https://book.douban.com/subject/1084336/comments/hot?p=1')
html =r.text #把内容赋值给HTML

#解析
from lxml import  etree #引入lxml的etree
s = etree.HTML(html)#把html转换成lxml可解析的对象
text_list =s.xpath('//*[@id="comments"]/ul/li/div[2]/p/text()')#解析这一页text

import pandas as pd #引入plandas,简写成pd
df = pd.DataFrame(text_list)
df.to_excel('D://xiaowangzi.xlsx')#把结果输出为Excel格式，存在D盘。
